<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
	
	<f:metadata>
		<f:event type="preRenderView" listener="#{userBean.navigateToMainIfLoggedIn}" />
		<f:event type="preRenderView" listener="#{loginBackingBean.init}" />
	</f:metadata>

	<ui:composition template="generalTemplate.xhtml">
		<ui:define name="title">
		    Giriş
		</ui:define>
		<ui:define name="content">
			
			<!-- Page Header -->
			<header class="jumbotron subhead">
	    		<h1>Giriş</h1>
	    		<p class="lead">Giriş yapmak için lütfen aşağıdaki formu doldurun.</p>
	  		</header>
	  		<!-- /Page Header -->
					
			<div class="row">
				<div class="span12">
					<!-- Login Form -->
					<h:form styleClass="form-horizontal">
					<legend>Giriş Formu</legend>
						<fieldset>
							<div class="control-group">
								<h:outputLabel styleClass="control-label" value="E-posta" />
								<div class="controls">
									<h:inputText value="#{loginBackingBean.email}"
					    					required="true"
					    					requiredMessage="'E-posta' alanı boş bırakılamaz"
					    					validatorMessage="Lütfen geçerli bir e-posta adresi giriniz">
			   							<f:validateRegex pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" />
		   							</h:inputText>
								</div>
							</div>
							<div class="control-group">
								<h:outputLabel styleClass="control-label" value="Parola" />
								<div class="controls">
						    		<h:inputSecret redisplay="true" value="#{loginBackingBean.password}"
						    					required="true"
						    					requiredMessage="'Parola' alanı boş bırakılamaz" />
						    		<span class="help-inline">
						    			<h:link value="Parolanızı mı unuttunuz?" outcome="lostPassword" />
						    		</span>
								</div>
							</div>
							<div class="control-group">
								<div class="controls">
									<label class="checkbox">
										<h:selectBooleanCheckbox value="#{loginBackingBean.rememberMe}" />
										Beni hatırla
									</label>
								</div>
							</div>
							<div class="form-actions">
								<c:if test="#{! empty facesContext.messageList}">
									<div class="alert alert-error">
										<a class="close" data-dismiss="alert">×</a>
										<strong>Hay aksi!</strong>
										<h:messages />
									</div>
								</c:if>
								<div class="submitDiv">
									<h:commandLink styleClass="btn btn-primary" value="Giriş yap"
												action="#{loginBackingBean.loginAction}" />
			    				</div>
							</div>
						</fieldset>
					</h:form>
					<!-- /Login Form -->
				</div><!-- end of span12 -->
			</div><!-- end of row -->
		</ui:define>
	</ui:composition>
</html>